// If this is an upstream dep we don't want warnings from, turn off all
// lints.
if !cx.show_warnings(unit.pkg.package_id()) {
- if cx.config.rustc()?.cap_lints {
- rustc.arg("--cap-lints").arg("allow");
- } else {
- rustc.arg("-Awarnings");
- }
+ rustc.arg("--cap-lints").arg("allow");
// If this is an upstream dep but we *do* want warnings, make sure that they
// don't fail compilation.
} else if !unit.pkg.package_id().source_id().is_path() {
- if cx.config.rustc()?.cap_lints {
- rustc.arg("--cap-lints").arg("warn");
- } else {
- rustc.arg("-Awarnings"); // not much to do on older compilers
- }
+ rustc.arg("--cap-lints").arg("warn");
}
let filenames = cx.target_filenames(unit)?;
pub path: PathBuf,
pub verbose_version: String,
pub host: String,
- /// Backwards compatibility: does this compiler support `--cap-lints` flag?
- pub cap_lints: bool,
}
impl Rustc {
pub fn new(path: PathBuf) -> CargoResult<Rustc> {
let mut cmd = util::process(&path);
cmd.arg("-vV");
-
- let mut first = cmd.clone();
- first.arg("--cap-lints").arg("allow");
-
- let (cap_lints, output) = match first.exec_with_output() {
- Ok(output) => (true, output),
- Err(..) => (false, cmd.exec_with_output()?),
- };
-
+
+ let output = cmd.exec_with_output()?;
+
let verbose_version = String::from_utf8(output.stdout).map_err(|_| {
internal("rustc -v didn't return utf8 output")
})?;
path: path,
verbose_version: verbose_version,
host: host,
- cap_lints: cap_lints,
})
}
use std::path::Path;
use cargo::util::process;
-use cargotest::{sleep_ms, RUSTC};
+use cargotest::sleep_ms;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::{git, project, execs, main_file, path2url};
use hamcrest::{assert_that,existing_file};
#[test]
fn denied_lints_are_allowed() {
- let enabled = RUSTC.with(|r| r.cap_lints);
- if !enabled { return }
-
let a = git::new("a", |p| {
p.file("Cargo.toml", r#"
[project]